package com.example.configs;

import javax.sql.DataSource;

import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class MultipleDBConfig {

	@Bean(name = "springboot1")
	@ConfigurationProperties(prefix = "spring.springboot1")
	public DataSource mysqlDataSource() {
		return DataSourceBuilder.create().build();
	}

	@Bean(name = "springboot2")
	@ConfigurationProperties(prefix = "spring.springboot2")
	public DataSource postgresDataSource() {
		return DataSourceBuilder.create().build();
	}

}